<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title><?php echo $this->_tpl_vars['softtitle'] ?></title>
<link href="templates/css/baselist.css" rel="stylesheet" type="text/css" />
<link href="templates/css/all.css" rel="stylesheet" type="text/css" />
<link href="templates/css/clickmenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/control.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodyauto")){
			$('.manageadd').css({height:h-40});
			$('.manageedit').css({height:h-40});
		}
	}
	var orderpay_js_title_empty  = "<?php echo $this->_tpl_vars['ST']['orderpay_js_title_empty'] ?>";
	var orderpay_js_payis_empty  = "<?php echo $this->_tpl_vars['ST']['orderpay_js_payis_empty'] ?>";
	var orderpay_js_add_ok = "<?php echo $this->_tpl_vars['ST']['orderpay_js_add_ok'] ?>";
	var orderpay_js_add_no = "<?php echo $this->_tpl_vars['ST']['orderpay_js_add_no'] ?>";
	var iframename = "<?php echo $this->_tpl_vars['iframename'] ?>" ? "jerichotabiframe_0" : "<?php echo $this->_tpl_vars['iframename'] ?>";
	iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
	$(document).ready(function(){
		var h = $(window).height();
		$('.manageadd').css({height:h-40});
		var options = {
			beforeSubmit: formverify,
			success:saveResponse
		}
		$('#payplugadd').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})




	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['payname']==""){
			document.payplugadd.payname.focus();
			alert(orderpay_js_payname_empty);
			return false;
		}
		if(get['payis'].match(/^[0-9]{1}[0-9.]*$/ig)==null) {
			document.payplugadd.payis.focus();
			alert(orderpay_js_payis_empty);
			return false;
		}
		parent.windowsdig('Loading','iframe:index.php?archive=management&action=load','400px','180px','iframe',false);
	}
	function saveResponse(options){
		parent.closeifram();
		var tab=document.getElementById("payplugaddtab").value;
		if (options=='true'){
			if (tab=='true'){
				if(parent.frames[iframename].document.getElementById("selectform")){
					parent.frames[iframename].refresh('selectform','selectall','check_all');
				}
			}
			alert(orderpay_js_add_ok);
		}else{
			alert(orderpay_js_add_no);
		}
		if (tab=='true'){
			parent.onaletdoc()
		}
	}
</script>
</head>

<body>
<form name="payplugadd" id="payplugadd" method="post" action="index.php?archive=payplug&action=paysave">
	<input type="hidden" name="inputclass" value="add">
	<input type="hidden" name="tab" id="payplugaddtab" value="<?php echo $this->_tpl_vars['tab'] ?>">
	<div id="mainbodyauto" class="manageadd">
		<div class="maindobycontent">
			<!--查看已选择的类型-->
			<div class="suggestion">
				<span class="sugicon"><span class="strong colorgorning2"><?php echo $this->_tpl_vars['ST']['position_title'] ?></span><span class="colorgorningage"><?php echo $this->_tpl_vars['ST']['orderpay_add_mess'] ?></span></span>
			</div>
			<div class="sugtitle">
				<span class="sugtitleicon"><span class="strong colorgorning2"><?php echo $this->_tpl_vars['ST']['orderpay_add_infoname'] ?></span></span>
			</div>
			<div class="sugtitle-line"></div>
			<div class="formdiv">
				<table border="0" width="100%">
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"><?php echo $this->_tpl_vars['ST']['orderpay_add_type'] ?></td>
						<td width="85%" class="trtitle02">
							<select size="1" name="payclass" onChange="selectlinkagelng('orderattrlist','index.php?archive=payplug&action=attrindex&code='+this.value);">
								<?php if (count($this->_tpl_vars['pluglist'])>0){$divid_list=1;for($list=0;$list<count($this->_tpl_vars['pluglist']); $list++){?>
								<option value="<?php echo $this->_tpl_vars['pluglist'][$list]['code'] ?>"><?php echo $this->_tpl_vars['pluglist'][$list]['plugname'] ?></option>
								<?php }} ?>
							</select>
							<span class="cautiontitle"><?php echo $this->_tpl_vars['ST']['orderpay_add_type_mess'] ?></span>
						</td>
					</tr>
				</table>
			</div>
			<div class="sugtitle">
				<span class="sugtitleicon"><span class="strong colorgorning2"><?php echo $this->_tpl_vars['ST']['orderpay_add_otherinfo'] ?></span></span>
			</div>
			<div class="sugtitle-line"></div>
			<div class="formdiv" id="orderattrlist">
				<input type="hidden" name="plugcode" value="<?php echo $this->_tpl_vars['paylist']['code'] ?>"/>
				<input type="hidden" name="version" value="<?php echo $this->_tpl_vars['paylist']['version'] ?>"/>
				<table border="0" width="100%">
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"><?php echo $this->_tpl_vars['ST']['orderpay_add_payname'] ?></td>
						<td width="85%" class="trtitle02">
							<input type="text" name="payname" size="30" maxlength="80" value="<?php echo $this->_tpl_vars['paylist']['plugname'] ?>" class="infoInput"/>
							<span class="cautiontitle"><?php echo $this->_tpl_vars['ST']['orderpay_add_payname_mess'] ?></span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"><?php echo $this->_tpl_vars['ST']['orderpay_add_paycontent'] ?></td>
						<td width="85%" class="trtitle02"><textarea name="paycontent" cols="80" rows="5" class="infoInput"><?php echo $this->_tpl_vars['paylist']['desc'] ?></textarea></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"><?php echo $this->_tpl_vars['ST']['orderpay_add_iscod'] ?></td>
						<td width="85%" class="trtitle02">
							<input type="text" name="is_cod" disabled value="<?php if($this->_tpl_vars['paylist']['is_cod']==1){ ?><?php echo $this->_tpl_vars['ST']['open_botton_title'] ?><?php }else{ ?><?php echo $this->_tpl_vars['ST']['close_botton_title'] ?><?php } ?>" maxlength="20" size="5" class="infoInput">
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"><?php echo $this->_tpl_vars['ST']['orderpay_add_payis'] ?></td>
						<td width="85%" class="trtitle02"><input type="text" name="payis" size="4" maxlength="6" value="<?php echo $this->_tpl_vars['paylist']['pay_fee'] ?>" class="infoInput"/> % <span class="cautiontitle"><?php echo $this->_tpl_vars['ST']['orderpay_add_payis_mess'] ?></span></td>
					</tr>
					<?php if (count($this->_tpl_vars['paylist_config'])>0){$divid_list=1;for($list=0;$list<count($this->_tpl_vars['paylist_config']); $list++){?>
					<?php if($this->_tpl_vars['paylist_config'][$list]['type']=='text'){ ?>
					<tr class="trstyle2">
						<td class="trtitle01"><?php echo $this->_tpl_vars['paylist_config'][$list]['botname'] ?></td>
						<td class="trtitle02">
							<input type="text" name="inputvalue[]" maxlength="50" size="40" class="infoInput">
							<input type="hidden" name="inputname[]" value="<?php echo $this->_tpl_vars['paylist_config'][$list]['name'] ?>">
							<input type="hidden" name="inputtype[]" value="<?php echo $this->_tpl_vars['paylist_config'][$list]['type'] ?>">
							<input type="hidden" name="botname[]" value="<?php echo $this->_tpl_vars['paylist_config'][$list]['botname'] ?>">
							<input type="hidden" name="sevalue[]" value="">
						</td>
					</tr>
					<?php } ?>
					<?php if($this->_tpl_vars['paylist_config'][$list]['type']=='select'){ ?>
					<tr class="trstyle2">
						<td class="trtitle01"><?php echo $this->_tpl_vars['paylist_config'][$list]['botname'] ?></td>
						<td class="trtitle02">
							<select size="1" name="inputvalue[]">
								<?php if (count($this->_tpl_vars['paylist_config'][$list]['sevalue'])>0){$divid_i=1;for($i=0;$i<count($this->_tpl_vars['paylist_config'][$list]['sevalue']); $i++){?>
								<option value="<?php echo $i ?>" <?php if($this->_tpl_vars['paylist_config'][$list]['value']==$i){ ?>selected<?php } ?>><?php echo $this->_tpl_vars['paylist_config'][$list]['sevalue'][$i] ?></option>
								<?php }} ?>
							</select>
							<input type="hidden" name="inputname[]" value="<?php echo $this->_tpl_vars['paylist_config'][$list]['name'] ?>">
							<input type="hidden" name="inputtype[]" value="<?php echo $this->_tpl_vars['paylist_config'][$list]['type'] ?>">
							<input type="hidden" name="botname[]" value="<?php echo $this->_tpl_vars['paylist_config'][$list]['botname'] ?>">
							<input type="hidden" name="sevalue[]" value="<?php if (count($this->_tpl_vars['paylist_config'][$list]['sevalue'])>0){$divid_i=1;for($i=0;$i<count($this->_tpl_vars['paylist_config'][$list]['sevalue']); $i++){?><?php echo $this->_tpl_vars['paylist_config'][$list]['sevalue'][$i] ?>|<?php }} ?>">
						</td>
					</tr>
					<?php } ?>
					<?php }} ?>
				</table>
			</div>
		</div>
	</div>
	<div id="downbotton">
		<div id="subbotton">
			<table border="0" width="100%">
				<tr>
					<td id="right"><input type="submit" name="Submit" value="<?php echo $this->_tpl_vars['ST']['botton_add'] ?>" class="buttonface" /></td>
					<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="<?php echo $this->_tpl_vars['ST']['botton_add_reset'] ?>" class="buttonface" /></td>
				</tr>
			</table>
		</div>
	</div>
</form>
</body>

</html>